#pragma once
//#include "AbstractItemView.h"

namespace DuiLib
{
	class UILIB_API CListViewUI : public CAbstractItemView,
								  public CListUI
	{
	public:
		DECLARE_DUICONTROL(CListViewUI)

	public:
		CListViewUI();
		~CListViewUI();

		virtual void setModel(CAbstractItemModel* pModel);


	protected Dui_Slots:
		virtual void onDataChanged(const CModelIndex& index,
			const CVar& oldValue, const CVar& newValue);
		virtual void onHeaderDataChanged(int section, Orientation orient,
			const CVar& oldValue, const CVar& newValue);

		virtual void onRowsBefroreInsert(int row, int count, const CModelIndex&);
		virtual void onRowsInserted(int row, int count, const CModelIndex&);

		virtual void onRowsBefroreRemove(int row, int count, const CModelIndex&);
		virtual void onRowsRemoved(int row, int count, const CModelIndex&);

		virtual void onRemoveAll(int rowCount);

		void OnListItemClicked(int nIndex, int nClumn, RECT* lpRCColumn, LPCTSTR lpstrText);

	private:
		void showModel();

		CControlUI* getItemWidget(const CModelIndex& index);

		CControlUI* addLineToWidget();


		void setColumnCount(int count);

		void OnSetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);

	};

}
